<?php
namespace App\core;
use App\test\MyRedis;
use App\annotations\Value;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;

AnnotationRegistry::registerLoader('class_exists');
class ClassFactory{
    public static function loadClass($classname){
           $ref_class=new \ReflectionClass($classname);
           ///////////只处理 属性注解
         $properties= $ref_class->getProperties();
         //  return
          $reader=new  AnnotationReader();
          foreach ($properties as $property){
              $annos=$reader->getPropertyAnnotations($property);
              foreach ($annos as $anno){var_dump('anno',$anno);
                 $getValue=$anno->do(); // 假设do 返回我们的业务数据
                 $retObj=$ref_class->newInstance();
                 $property->setValue($retObj,$getValue);
                 return $retObj;
              }
          }
            return false;

    }
}